package com.example.javafx.选择框;

import com.sun.javafx.scene.control.behavior.ChoiceBoxBehavior;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableArray;
import javafx.collections.ObservableList;
import javafx.scene.Cursor;
import javafx.scene.Scene;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ChoiceBoxBuilder;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

/**
 * checkbox填充数据
 */
public class Main_1 extends Application {

    ObservableList cursors = FXCollections.observableArrayList(
            Cursor.DEFAULT,
            Cursor.CROSSHAIR,
            Cursor.WAIT,
            Cursor.TEXT,
            Cursor.HAND,
            Cursor.MOVE,
            Cursor.N_RESIZE,
            Cursor.NE_RESIZE,
            Cursor.E_RESIZE,
            Cursor.SE_RESIZE,
            Cursor.S_RESIZE,
            Cursor.SW_RESIZE,
            Cursor.W_RESIZE,
            Cursor.NW_RESIZE,
            Cursor.NONE
    );

    @Override
    public void start(Stage primaryStage) throws Exception {
        ChoiceBox choiceBoxRef = ChoiceBoxBuilder.create().items(cursors).build();
        VBox box = new VBox();
        box.getChildren().add(choiceBoxRef);
        final Scene scene = new Scene(box,300,250);
        scene.setFill(null);
        primaryStage.setScene(scene);
        primaryStage.show();
        scene.cursorProperty().bind(choiceBoxRef.getSelectionModel().selectedItemProperty());
    }

    public static void main(String[] args) {
        launch(args);
    }
}
